require 'base64'
class ReditController < ApplicationController
  def open
    file = Base64.decode64(params[:id])
    line = params[:line].to_s

    # Run editor here
    Thread.new do
      ### Gvim
      # Open file in current buffer of vim server
      # system("gvim","--remote","+#{line}",file)
      #`gvim --remote-send "zv"`                    # open fold under cursor (if any)
      
       Gedit
      `gedit +#{line} #{file}`                    # or
      `gedit +#{line} --new-document #{file}`     # or
      `gedit +#{line} --new-window #{file}` 

      ### Kdevelop
      #`kdevelop #{file}`                           # Can't define line number :-/ 
      
      ### Anjuta
      #`anjuta #{file}`                             # Can't define line number :-/ 

      ### Scite
      #`scite #{file}`                              # Can't define line number :-/ 

    end 
    redirect_to :back
  end
end
